package binaryTree.basic;

import binaryTree.TreeNode;

public class BinaryTreeLeafSum {

    //  CKG TODO 2023/4/2: 计算每个节点左右子树各个节点数值的和和该节点的值的和
    private int findTilt0(TreeNode node) {
        if (node == null) return 0;
        if (node.left == null && node.right == null) return node.val;
        int leftSum = findTilt0(node.left);
        int rightSum = findTilt0(node.right);
        return leftSum + rightSum + node.val;

    }
}
